{include file="public/head" /}
<title>发布权限管理</title>
</head>

<body>
<div id="right_ctn">
    <div class="right_m">
        <div class="hy_list">
            <div class="box_t">
                <span class="name">发布者权限管理</span>
                <!--当前位置-->
                <div class="position">
                    <a><img src="__STATIC__/admin/images/icon5.png" alt=""/></a>
                    <a href="{:url('admin/Index/index')}" target="_top">首页</a>
                    <span><img src="__STATIC__/admin/images/icon3.png" alt=""/></span>
                    <a href="">用户管理</a>
                    <span><img src="__STATIC__/admin/images/icon3.png" alt=""/></span>
                    <a href="{:url('admin/NewsmakerController/index')}">发布者权限管理</a>
                </div>
                <!--当前位置-->
            </div>
            <div class="space_hx">&nbsp;</div>
            <div class="xjhy" style="padding:0px;">
                <div class="tabBox_t">
                    <div class="tabBox">
                      <ul class="tabNav">
                          <li><span><a href="{:url('admin/NewsmakerController/index')}">发布者信息</a></span></li>
                          <li class="now"><span><a href="{:url('admin/NewsmakerController/add')}">添加发布者</a></span></li>
                      </ul>
                        <div class="tabCont" style="height: 200px; display: block;">
                            <form action="{:url('admin/NewsmakerController/addPost')}" method="post" id="form">
                            <div class="col-md-5">
                                <div class="form-group">
                                    <label for="department"><span class="form-required">*</span>部门</label>
                                    <select id="department" name="department" class="form-control" onchange="showStaff(this)">
                                        <option value="" hidden>请选择部门</option>
                                        {volist name="depList" id="vo"}
                                        <option value="{$vo.id}">{$vo.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="staff_id"><span class="form-required">*</span>姓名</label>
                                    <select name="staff_id" id="staff_id" class="form-control">
                                        <option value="" hidden>请选择员工</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <a class="btn btn-primary ajax-submit">添加</a>
                                    <a class="btn btn-default" href="{:url('admin/NewsmakerController/index')}">返回</a>
                                </div>
                            </div>
                            </form>
                        </div>               
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    //ajax显示所选部门下的员工列表
    function showStaff(self) {
        var dep_id = self.value;
        $.post("/admin/newsmaker_controller/showStaff",{did:dep_id},function(result){
             $("#staff_id option:not(:first)").remove();
             var data = result['data'];
             var select = $("#staff_id");
             for (var i = 0; i < data.length; i++) {
                 select.append('<option  value="' + data[i]['id'] + '">' + data[i]['name'] + '</option>');
             }
        },"json");
    }
</script>
<script src="__STATIC__/js/ajax-form.js"></script>
</body>
</html>
